<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>历史年检信息</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel="stylesheet" type="text/css" href="../../css/style.css">
	<script type="text/javascript" src="../../js/jquery-1.8.2.js"></script>
	<script type="text/javascript" src="../../js/dialog/jquery.artDialog.source.js?skin=default"></script>
	<script type="text/javascript" src="../../js/dialog/plugins/iframeTools.source.js"></script>
	<script type="text/javascript" src="../../js/datepicker/WdatePicker.js"></script>
	<script type="text/javascript" src="../../js/jquery.ztree.all-3.5.min.js"></script>
	<script type="text/javascript" src="../../js/jquery.form.js"></script>
	<script type="text/javascript" src="../../js/jquery.page.js"></script>
	<script type="text/javascript" src="../../js/base.js"></script>
	<script type="text/javascript">
	$(function(){
		$('select[name=adminCode]').selectload('../../common/adminunit_select.action','adminCode','adminName');
		$('select[name=propertyCode]').selectload('../../common/propertyunit_select.action','propertyCode','propertyName');
		$('select[name=serviceCode]').selectload('../../common/serviceunit_select.action','serviceCode','serviceName');
		//渲染区域树
		$.fn.zTree.init($('#areaTree'),{
			data: {
				key:{
					name:'areaname'
				},
				simpleData: {
					enable: true,
					idKey:'areacode',
					pIdKey:'parentcode',
					rootPId:0
				}
			},
			async: {
				enable: true,
				url:"../../common/area_tree.action",
				autoParam:["areacode"]
			},
			callback:{
				onClick:function(e,id,node){
					if(node.isParent == false){
						$('input[name=areaName]').val(node.areacode);
						var $areaTree = $('.areaTree');
						var areaArr = new Array();
						areaArr.unshift(node.areaname);
						while(node.parentcode > 0){
							node = node.getParentNode();
							areaArr.unshift(node.areaname);
						}
						$('input[name=areaNameN]').val(areaArr.join(' > '));
						$areaTree.hide();
					}
				}
			}
		});
		$('input[name=areaNameN]').click(function(){
			$this = $(this);
			$hidden = $('input[name=areaName]');
			$areaTree = $('.areaTree');
			$this.val('');
			$hidden.val('');
			var os = $this.offset();
			$areaTree.css({left:os.left,top:os.top+($this.outerHeight(true)-1)});
			$areaTree.show();
		});
		$(document).mouseup(function(e){
			var $target = $(e.target);
			if(!$target.is('.areaTree')){
				if($target.parents('.areaTree').length == 0){
					$('.areaTree').hide();
				}
			}
		});
		//区域树结束

		//列表
		$('#list').page({
			url:'lsnjxx_search.action',
			config:'pageinfo,record,first,last,next,prev,jump',
			items:[{
				title:'年检单号',
				name:'cardNumber'
			},{
				title:'电梯名称',
				name:'eleName'
			},{
				title:'年检人员姓名',
				name:'adminUserName'
			},{
				title:'年检开始时间',
				name:'checkStartTime'
			},{
				title:'年检结束时间',
				name:'checkEndTime'
			},{
				title:'详情',
				render:function(row){
					$a = $('<a href="javascript:void(0)")">【详细】</a>');
					$a.click(function(){
						view(row);
					});
					return $a;
				}
			}]
		});

		$(document.search).ajaxForm({
			beforeSubmit:function(formData){
				var param = $(formData).formParam();
				$('#list').page('param',param);
				$('#list').page('show');
				return false;
			}
		});
		$('#btnExcel').click(function(){
			var s = document.search
			var para = {
				'k':'lsnjxx',
				'adminCode':s.adminCode.value,
				'propertyCode':s.propertyCode.value,
				'serviceCode':s.serviceCode.value,
				'eleCode':s.eleCode.value,
				'serUserName':s.serUserName.value,
				'starttime':s.starttime.value,
				'endtime':s.endtime.value
			}
			window.location.href="../../common/excel_io.action?"+$.param(para);
		});
	});
	var view = function(row){
		$.dialog({
			id:'viewdialog',
			title:'信息查看-历史年检信息',
			lock:true,
			width:'100%',
			height:'100%',
			content:document.getElementById('view')
		});
		$('#viewForm').json2form(row);
	}
	</script>
</head>
<body class="app">
	<h3>历史年检信息</h3>
	<div class="areaTree"><div id="areaTree" class="ztree"></div></div>
	<form class="search" name="search">
		<div class="tbdiv">
		<table>
			<tr>
				<th width="90">行政监管单位：</th>
				<td width="100"><select name="adminCode"></select></td>
				<th width="90">物业公司：</th>
				<td width="100"><select name="propertyCode"></select></td>
				<th width="90">维保单位：</th>
				<td><select name="serviceCode"></select></td>
			</tr>
			<tr>
				<th width="90">电梯编号：</th>
				<td width="100"><input type="text" class="inputText" name="eleCode" value="" style="width:100px;"/></td>
				<th width="90">年检人姓名：</th>
				<td colspan="3"><input type="text" class="inputText" name="serUserName" value="" style="width:100px;"/></td>
			</tr>
			<tr>
				<th width="90">起始时间：</th>
				<td width="100"><input type="text" id="st" class="inputText" name="starttime" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'et\')}'})" style="width:100px;"/></td>
				<th width="90">截止时间：</th>
				<td colspan="3"><input type="text" id="et" class="inputText" name="endtime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'st\')}'})" style="width:100px;"/></td>
			</tr>
			<tr>
				<td colspan="6">
					<table>
						<tr>
							<th width="89">所属区域：</th>
							<td>
								<input type="hidden" name="areaName" value=""/>
								<input type="text" class="inputText" name="areaNameN" value="" style="width:347px;*width:348px;cursor:pointer;" readonly="readonly" />
							</td>
							<td><input type="submit" value="查询" class="inputButton"/></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		</div>
	</form>
	<div id="list"></div>
	<div class="optionlink">
		<span id="btnPrint">【打印】</span>
		<span id="btnExcel">【导出Excel】</span>
		<span id="btnUpd1">【完善年检内容】</span>
		<span id="btnUpd2">【年检评价】</span>
	</div>
	<div id="view" style="width:650px;display:none;">
		<form name="viewForm" id="viewForm">
		<dl class="view">
			<dt>年检单号：</dt>
			<dd class="giant"><label name="cardNumber"></label></dd>
			<dt>电梯号码：</dt>
			<dd class="giant"><label name="eleCode"></label></dd>
			<dt>电梯名称：</dt>
			<dd class="giant"><label name="eleName"></label></dd>
			<dt>年检单位：</dt>
			<dd class="giant"><label name="adminName"></label></dd>
			<dt>年检人姓名：</dt>
			<dd class="giant"><label name="adminUserName"></label></dd>
			<dt>年检开始时间：</dt>
			<dd class="giant"><label name="checkStartTime"></label></dd>
			<dt>年检结束时间：</dt>
			<dd class="giant"><label name="checkEndTime"></label></dd>
			<dt>年检内容：</dt>
			<dd class="giant"><label name="checkContent"></label></dd>
			<dt>年检评价：</dt>
			<dd class="giant"><label name="checkValue"></label></dd>
		</dl>
		</form>
	</div>
</body>
</html>
